#!/usr/bin/env python
# -*- coding: utf-8 -*-

from django.db import models

class Snippet(models.Model):
    " Текстовый фрагмент "
    CHOICES_FILTER = enumerate([u"Текст", u"HTML", u"WYSIWYG-редактор"])

    header = models.CharField(verbose_name=u"Заголовок", max_length=250)
    publish = models.BooleanField(verbose_name=u"Опубликовать", default=True)
    slug = models.SlugField(verbose_name=u"Имя", unique=True, help_text=u"Например: footer")
    filter = models.PositiveIntegerField(verbose_name=u"Тип", choices=CHOICES_FILTER, default=0)
    content = models.TextField(verbose_name=u"Контент", blank=True)

    def __unicode__(self):
        return self.header

    class Meta:
        ordering = ('slug',)
        verbose_name = u"Текстовый фрагмент"
        verbose_name_plural = u"Текстовые фрагменты"
